package worldinruin.gui.imp.gameview.gameboard.tiles;

import java.awt.Image;
import java.util.HashMap;

import javax.swing.ImageIcon;

import worldinruin.core.ITile;
import worldinruin.core.imp.tilemodels.TileTypes;

public class TileViewFactory  {
	
	private static HashMap<Enum<TileTypes>, Image> map = new HashMap<Enum<TileTypes>, Image>();
	private Image fertileImage = new ImageIcon("src/worldinruin/resources/images/fertileTile2.jpg").getImage();;
	private Image forestImage = new ImageIcon("src/worldinruin/resources/images/treeTile.JPG").getImage();;
	private Image grassImage = new ImageIcon("src/worldinruin/resources/images/grassTile.JPG").getImage();;
	private Image ironImage = new ImageIcon("src/worldinruin/resources/images/ironTile.JPG").getImage();
	private Image stoneImage = new ImageIcon("src/worldinruin/resources/images/stoneTile.JPG").getImage();;
	
	/**
	 * Different tileviews that can be displayed on gameboard.
	 */
	public TileViewFactory(){

		map.put(TileTypes.FERTILETILE, fertileImage);
		map.put(TileTypes.FORESTTILE, forestImage);
		map.put(TileTypes.GRASSTILE, grassImage);
		map.put(TileTypes.IRONTILE, ironImage);
		map.put(TileTypes.STONETILE, stoneImage);
		
	}
	
	/**
	 * Creates a new tile.
	 * @param model Tile model.
	 * @return Tile.
	 */
	public TileView newTile(ITile model){
		return new TileView(model, map.get(model.getTileType()));
	}
	
	

	
	
	
	

}
